<?php

namespace app\api\controller;

use app\api\model\CustomerService AS CustomerModel;
use app\api\validate\Page;

class CustomerService extends Base
{
    /**
     * 首页搜索
     * @return array
     * @throws \think\Exception\DbException
     */
    public function index()
    {
        $page = $data['page'] = input('page') ? input('page') : 1;
        $size = $data['size'] = input('size') ? input('size') : $this->pageSize;

        // 检测变量
        $validate = new Page();
        if (!$validate->check($data)) {
            return self::sendResult(102, [], $validate->getError());
        }

        $model = CustomerModel::getList($page, $size);
        return self::sendResult(self::$okCode, $model);
    }
}